/*
 * @Author: 入口文件
 * @Date: 2020-05-21 09:28:06
 * @LastEditTime: 2020-05-26 11:24:18
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \jump\assets\script\G.ts
 */ 

import { GameScene } from "./game/GameScene";

export class Global extends cc.EventTarget {
    // 设置一个全局只读的Instance并且把构造函数设为private，这样就确保了单例的特点。
    public static readonly Instance: Global = new Global();

    private constructor() {
        super();
    }

    // 启动 game 场景函数
    public startGame () {
        cc.director.loadScene("game", function (err, scene) {
            if(err) {
                return; 
            }
            let gameScene: GameScene = scene.getChildByName("Canvas").getComponent(GameScene);
        });
    }
}

// 单例
export const G = Global.Instance;